<template>
  <div class="am-content">
    <div class="amc-toolbar">
      <el-button type="primary" icon="el-icon-plus" @click="handleAdd">新增</el-button>
    </div>
    <img v-bind:src="imgUrl | fileFilter" alt="">
    <sign-board v-bind:showSignboard="showSignboard" v-on:canvasDown="canvasDown" v-on:canvasClose="canvasClose"></sign-board>
  </div>
</template>

<script>

import SignBoard from "@/components/SignBoard";
import CommonFilters from "@/mixins/CommonFilters";
import HttpConnection from "@/util/HttpConnection";

export default {
  name: "ManageSign",
  components: { SignBoard },
  mixins: [CommonFilters],
  data(){
    return {
      showSignboard: false,
      imgUrl: ""
    }
  },
  mounted() {
    this.toQuery();
  },
  methods: {
    toQuery(){
      let that = this;
      HttpConnection.post("/api-bureau/minorAccident/manager/getSign", {
      }).then(function(response){
        that.imgUrl = response.data.path;
      });
    },
    resetQuery(){},
    refreshQuery(){},
    handleAdd(){
      let that = this;
      that.showSignboard = true;
    },
    canvasDown(e){
      let that = this;
      that.showSignboard = false;
      HttpConnection.post("/api-bureau/minorAccident/manager/saveSign", {
        path: e
      }).then(function(){
        that.toQuery();
      });
    },
    canvasClose(){
      let that = this;
      that.showSignboard = false;
    }
  }
}
</script>

<style scoped lang="scss">
@import "../../../styles/police-common";
</style>
